﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tank
{
    public class Data
    {
        /// <summary>
        /// 当前游戏状态
        /// </summary>
        public static GameState indexState = GameState.StartFrame;

        /// <summary>
        /// 当前选择坦克状态
        /// </summary>
        public static selectTankState indexselectTankState = selectTankState.EditMap;

        /// <summary>
        /// 游戏状态
        /// </summary>
        public enum GameState
        {
            /// <summary>
            /// 开始画面
            /// </summary>
            StartFrame = 0,
            /// <summary>
            /// 游戏画面
            /// </summary>
            GameFrame
        }

        /// <summary>
        /// 选择坦克的位置
        /// </summary>
        public enum selectTankState
        {
            /// <summary>
            /// 一个玩家
            /// </summary>
            OnePlay = 0,
            /// <summary>
            /// 两个玩家
            /// </summary>
            TwoPlay,
            /// <summary>
            /// 编辑地图
            /// </summary>
            EditMap
        }

        /// <summary>
        /// 获取选择坦克向下一个位置
        /// </summary>
        /// <returns></returns>
        public static selectTankState getNextSelectTankState()
        {
            try
            {
                int index = (int)indexselectTankState;
                if (indexselectTankState == selectTankState.EditMap)
                    return indexselectTankState;
                else
                    return (selectTankState)(++index);
            }
            catch
            {
                return indexselectTankState;
            }
        }

        /// <summary>
        /// 获取选择坦克向上一个位置
        /// </summary>
        /// <returns></returns>
        public static selectTankState getLastSelectTankState()
        {
            try
            {
                int index = (int)indexselectTankState;
                if (indexselectTankState == selectTankState.OnePlay)
                    return indexselectTankState;
                else
                    return (selectTankState)(--index);
            }
            catch
            {
                return indexselectTankState;
            }
        }
    }
}
